import React from 'react'
import PropTypes from 'prop-types'
import { Text, View, Button } from '@tarojs/components'
import Taro from "@tarojs/taro"
import './index.less'
import * as PatientManagementList from "./patientManagementList"
import TabBar from "../common/taBar"


/**
 * 就诊人管理 主页
 */
class Index extends React.Component {
  state: { patients };
  static propTypes: { patients: PropTypes.Validator<any[]> }
  constructor(props: {} | Readonly<{ any: any }>) {
    super(props)
    this.state = {
      patients: []
    }
  }
  //跳转到填写病人信息的页面
  toWriteInfo() {
    Taro.navigateTo({ url: 'patientRegistration' })
  }
  componentDidMount() {
    // Taro.getStorage({
    //   key: '__itemcode__',
    //   success:(res)=> {
    //     const itemcode=res.data;
    //     Taro.request({
    //       url:`${APIBASEURL}/myRegisters/${itemcode}`,
    //       header: {
    //         'content-type': 'application/json' // 默认值
    //       },
    //       method: 'GET',
    //       dataType: 'json',
    //       credentials: 'include',
    //       success: (res) => {
    //         this.setState({
    //           registrations: res.data.data
    //         })
    //         console.log("<>>" + this.state.registrations)
    //         if (this.state.registrations && this.state.registrations.length==0){
    //           Taro.showToast({
    //             title: '您没有挂号记录！',
    //             icon: 'none',
    //             duration: 3000
    //           })
    //         }
    //       },
    //       fail: function (errMsg) {
    //         Taro.showToast({
    //           title: '服务器请求失败!',
    //           icon: 'none',
    //           duration: 3000
    //         })
    //       }
    //     });
    //   }
    // })

  }

  render() {  

    let patients = this.state.patients;
    return (
      <view className='patient-mgr-h'>
          <PatientManagementList></PatientManagementList>
   
      </view>

    )
  }
}

Index.propTypes = {
  patients: PropTypes.array.isRequired,
}

export default Index;
